<style type="text/css">
	a.btnDelete{display:none !important;}
</style>
<script type="text/javascript">
//<![CDATA[
	function frmValid(){
		with(document.frmReg){
			if(!serise.value){
				alert("시리즈를 선택해 주세요");
				serise.focus();
				return;
			}

			if(checkEmpty(airdate)){
				alert("일자를  입력해주세요");
				airdate.focus();
				return;
			}

			if(checkEmpty(worship)){
				alert("예배를 입력해주세요");
				worship.focus();
				return;
			}

			if(checkEmpty(runtime)){
				alert("런닝타임을 입력해주세요");
				runtime.focus();
				return;
			}

			if(checkEmpty(bible)){
				alert("장절을 입력해주세요");
				bible.focus();
				return;
			}

			if(checkEmpty(title)){
				alert("제목을 입력해주세요");
				title.focus();
				return;
			}

			if(!CKEDITOR.instances.textarea_id.getData()){
				alert("내용을 입력해주세요");
				content.focus();
				return;
			}

			if(checkEmpty(vod_url)){
				alert("영상주소를 입력해주세요");
				vod_url.focus();
				return;
			}

			submit();
		}
	}


	function frmDelete(){
		if(!confirm('삭제 하시겠습니까?'))return;
		with(document.frmReg){
			dbjob.value = 'd';
			submit();
		}	 
	}
	
	$.datepicker.setDefaults({
		dateFormat: 'yy-mm-dd'
	});

	$(function(){
		$(".datepicker").datepicker();
		$(".btn_calendar").click(function(){
			var index = $(".btn_calendar").index($(this));
			$('.datepicker').eq(index).datepicker('show');	
		});

		//삭제버튼
		if($("[name=dbjob]").val() == 'u'){ 
			$(".btnDelete").show();
		}

		slide_open('.frmReg');
	});
			
//]]>
</script>
<div class="box_type02">
	<h2 class="txt">설교방송관리</h2>
	<p class="icon"><a href="javascript:void(0);" class="icon_m04">매뉴얼</a></p>

	<!--[s] 쓰기 -->
	<form name="frmReg" class="frmReg" method="post" action="/sermon/sermonDbjob" enctype="multipart/form-data">
	<input type="hidden" name="dbjob" value="<?php echo $dbjob?>">
	<input type="hidden" name="id" value="<?php echo $sermon_id?>">
	<fieldset class="board_write">
		<legend>설교방송관리</legend>
		<table cellspacing="0" summary="설교방송관리" class="lines">
			<caption>설교방송관리</caption>
			<tr>
				<th scope="row" width="140"><p class="point">시리즈</p></th>
				<td>
					<div>
						<select name="serise" class="ip_s">
							<?php 
								foreach($serise as $row){
									echo "<option value=\"{$row->code_id}\">{$row->title}</option>\n";
								}
							?>
						</select>
						<span class="txt_type02">추가시 코드관리에서 등록</span>
					</div>
				</td>
			</tr>
			<tr>
				<th scope="row"><p class="point">일자</p></th>
				<td>
					<div>
						<input type="text" id="" name="airdate" class="ip_i datepicker" style="width:148px;" value="<?php echo $airdate;?>" />
						<a href="javascript:void(0);" class="btn_calendar">달력보기</a>
					</div>
				</td>
			</tr>
			<tr>
				<th scope="row"><p class="point">예배</p></th>
				<td>
					<div>
						<input type="text" id="" name="worship" class="ip_i" style="width:174px;" value="<?php echo $worship;?>" />
					</div>
				</td>
			</tr>
			<tr>
				<th scope="row"><p class="point">런닝타임</p></th>
				<td>
					<div>
						<input type="text" id="" name="runtime" class="ip_i" style="width:174px;" value="<?php echo $runtime;?>" />
						<span class="txt_type03">분 : 초</span>
					</div>
				</td>
			</tr>
			<tr>
				<th scope="row"><p class="point">장절</p></th>
				<td>
					<div>
						<input type="text" id="" name="bible" class="ip_i" style="width:174px;" value="<?php echo $bible;?>" />
					</div>
				</td>
			</tr>
			<tr>
				<th scope="row"><p>설교자</p></th>
				<td>
					<div>
						<input type="text" id="" name="preacher" class="ip_i" style="width:174px;" value="<?php echo $preacher;?>" />
					</div>
				</td>
			</tr>
			<tr>
				<th scope="row"><p class="point">제목</p></th>
				<td>
					<div><input type="text" id="" name="title" class="ip_i" style="width:584px;" value="<?php echo $title;?>" /></div>
				</td>
			</tr>
			<tr>
				<th scope="row"><p class="point">내용</p></th>
				<td>
					<div>
					<textarea id="textarea_id" name="content" rows="" cols="" class="ip_t"><?php echo $content;?></textarea>
					<?php echo display_ckeditor($_ckeditor); ?>
					</div>
				</td>
			</tr>
			<tr>
				<th scope="row"><p class="point">이미지</p></th>
				<td>
					<div>
						<input type="file" id="" name="file1" class="ip_i" style="width:279px;" value="" />
						<!-- <a href="javascript:void(0);" class="btn_search">찾아보기</a> -->
						<span class="txt_type02">.80x52 생략시 목사님 이미지가 올라갑니다.</span>
					</div>
				</td>
			</tr>
			<tr>
				<th scope="row"><p class="point">영상주소</p></th>
				<td>
					<div>
						<input type="text" id="" name="vod_url" class="ip_i" style="width:279px;" value="<?php echo $vod_url;?>" />
						<!-- <a href="javascript:void(0);" class="btn_search">찾아보기</a> -->
					</div>
				</td>
			</tr>
			<tr>
				<th scope="row"><p class="point">오픈구분</p></th>
				<td>
					<div>
						<a href="javascript:void(0);" class="disBtn"><img src="/theme/<?=$_theme?>/images/common/btn_on_off.gif" alt="on" /></a>
						<!-- 히든 인풋박스에 on off 들어가게 구성되어 있음 -->
						<input type="hidden" id="displays" name="open_yn" value="<?php echo $open_yn;?>" />
					</div>
				</td>
			</tr>
		</table>
	</fieldset>
	<!--[e] 쓰기 -->
	</form>
	
	<!-- [s] 버튼 -->
	<ul class="botton_box mt30">
		<li class="center">
			<?php 
				//버튼 이미지 변경
				$btn_image = ($dbjob == 'i') ? 'btn_ok.gif' : 'btn_modify.gif';
			?>
			<a href="javascript:frmValid();"><img src="/theme/<?=$_theme?>/images/common/<?php echo $btn_image;?>" alt="" /></a>
			<a href="javascript:frmDelete();" class="btnDelete"><img src="/theme/<?=$_theme?>/images/common/btn_delete.gif" alt="삭제" /></a>
			<a href="javascript:history.back();"><img src="/theme/<?=$_theme?>/images/common/btn_cancel.gif" alt="취소" /></a>
		</li>
	</ul>
	<!-- [e] 버튼 -->

	<!--[s] Tip -->
	<dl id="tip" class="mt30">
		<dt>Tip</dt>
		<dd>인터넷익스플로러의 '호환성보기' 기능을 사용중인 접속자에게 자동으로 최신버전 기준으로 사이트를 출력하도록 처리합니다.</dd>
		<dd>코딩방식에 따라 특정 버전의 브라우저에서 사이트가 깨질수 있으니, 충분한 테스트 후 기능을 설정해 주시기 바랍니다.</dd>
	</dl>
	<!--[e] Tip -->
</div>
